package net.sourceforge.peertwitter.core.events;

import rice.p2p.commonapi.NodeHandle;

public class NodeJoin implements Event {

	private final NodeHandle nodeHandle;

	public NodeJoin(NodeHandle nodeHandle) {
		this.nodeHandle = nodeHandle;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((nodeHandle == null) ? 0 : nodeHandle.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NodeJoin other = (NodeJoin) obj;
		if (nodeHandle == null) {
			if (other.nodeHandle != null)
				return false;
		} else if (!nodeHandle.equals(other.nodeHandle))
			return false;
		return true;
	}

}
